from flask import Blueprint,request,session,redirect

# 创建管理员蓝图
admin_blue = Blueprint("admin",__name__,url_prefix="/admin")

# 装饰视图函shu
from . import views



# 使用请求钩子拦截普通用户，
@admin_blue.before_request
def before_request():
    # print("请求路径 = %s",%request_url)
    # 判断访问的是否是登陆页面s
    if not request.url.endswith("/admin/login"):
        if not session.get("is_admin"):
            return redirect("/")
